/*
 * Copyright (c) 2021, Peter Abeles. All Rights Reserved.
 *
 * This file is part of BoofCV (http://boofcv.org).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package boofcv.abst.sfm.d3;

import org.ddogleg.struct.VerbosePrint;

/**
 * Interface for Visual Odometry (VO) algorithms. VO estimates the camera's motion (egomotion) by tracking
 * the locations of image features and by applying geometric constraints.  The motion estimate is relative
 * to the camera's reference frame. In a multi-camera system the specific implementation specifies which
 * camera the motion is relative to.
 *
 * @author Peter Abeles
 */
public interface VisualOdometry<M> extends VerbosePrint {
	/** Key used to indicate that it should print out feature tracking information */
	String VERBOSE_TRACKING = "tracking";

	/**
	 * Forget past history and tracking results, returning it to its initial state.
	 */
	void reset();

	/**
	 * If a fatal error occurred while updating its state then this function will return true.
	 * Before more images can be processed {@link #reset()} must be called. Only needs to be
	 * called if process returns false.
	 *
	 * @return true if a fatal error has occurred.
	 */
	boolean isFault(); // TODO delete

	/**
	 * Returns the estimated motion relative to the first frame in which a fatal error
	 * does not happen.
	 *
	 * @return Found pose.
	 */
	M getCameraToWorld(); // TODO delete

	/**
	 * Returns the ID of the most recently processed frame. Starts at zero and increments with each call to process.
	 */
	long getFrameID();

	// The idea with the origin frame is that only information back to that frame is considered when estimating the
	// current pose.

//	/**
//	 * returns the ID of the origin frame that motion is estimated relative to
//	 */
//	long getOriginFrameID();

//	/**
//	 * Relationship between the current frame and the origin frame.
//	 *
//	 * @param storage Where the transform is written to
//	 * @return true if it is known or false if it is not
//	 */
//	boolean getCurrentToOrigin( M storage );
}
